package com.elephant.core.socket;

import com.elephant.core.utils.StreamUtils;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author hai
 * @description
 * @date 10:17 2018/8/31
 */
public class MySocketServer {

    public static void main(String[] args) {

        try {
            ServerSocket serverSocket = new ServerSocket(9099);

            Socket accept = serverSocket.accept();

            System.out.println(StreamUtils.inputStreamToString(accept.getInputStream()));

            serverSocket.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
